#ifndef ANALYZER_HPP
#define	ANALYZER_HPP

#include <boost/format.hpp>
#include <string>
#include <cassert>
#include <iostream>
#include "antlr_wrapper.hpp"
#include "ast.hpp"
#include "cfg.hpp"
#include "program_slicing.hpp"
#include "dead_code.hpp"
#include "lex_cast.h"
#include "buffer_underflow.hpp"
#include "buffer_outofbounds.hpp"
using namespace std;
class program;
class CFGvertex;
class CFGvisitorFlatInfo;


class analyzer {
public:
	analyzer(const string& while_file);
	void print_AST(const string& dot_file);
	void print_CFG(const string& dot_file);
	void print_LV_analysis();
	void print_RD_analysis();
	void print_DS_analysis();
	void print_IV_analysis();
	void print_program_slice(label_t poi);
	void print_dead_code();
	void print_underflow();
	void print_overunderflow();
	
private:
	void ensure_cfg_exists();
	void ensure_flatinfo_exists();
	void ensure_RD_has_run();
	void ensure_LV_has_run();
	void ensure_DS_has_run();
	void ensure_IV_has_run();
	
	program *ast_root;
	CFGvertex *cfg_root;
	CFGvisitorFlatInfo *flat;
	ReachingDefs *rd;
	LiveVariable *lv;
	DetectionSign *ds;
	IntervalAnalysis *iv;
};

#endif	/* ANALYZER_HPP */
